package com.example.careycai.playactivity;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

/**
 * Created by shelly.xu on 1/6/2016.
 */
public class MyDatabaseHelper extends SQLiteOpenHelper {

    public static final String CREATE_USERINFO="create table userinfo("
            + "id integer primary key autoincrement," +
            "name text," +
            "password text," +
            "time text)";

    public static final String CREATE_GAMES="create table games(" +
            "id integer primary key autoincrement," +
            "agent text," +
            "gname text," +
            "crate integer," +
            "attention text)";
     private Context mcontext;
    public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        mcontext=context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_USERINFO);
        db.execSQL(CREATE_GAMES);
        Toast.makeText(mcontext,"初始化成功",Toast.LENGTH_LONG).show();;
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
